Fixing test in aws_chunked inlineable#4430
Merged
landonxjames merged 2 commits intomainfrom Dec 2, 2025
Merged
Conversation
ysaito1001
approved these changes
Dec 2, 2025
|
A new generated diff is ready to view.
A new doc preview is ready to view. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: This PR will need to be released and have at least one daily release run to get the changes into the
aws-sdk-s3crate before thefeature/http-1.xbranch can be successfully merged to main.Motivation and Context
When merging
mainback to thefeature/http-1.xbranch in #4422 we started to see a new failure in the semver hazards test.The semver hazards test works by checking out the published versions of the SDK crates in the
aws-sdk-rustrepo, patching those crates to use the PRed versions of the runtime crates, and running the tests in the SDK crates with those patches in place.The currently published version of
test_aws_chunked_body_is_retryablecreates a temp file with size10000 x line.len(). TheAwsChunkedBodyOptionsare created with::default()which setsstream_length = 0. That means we hit this check in thehttp_body_04x::Bodyimpl forAwsChunkedBodywhich sets the state toAwsChunkedBodyState::WritingTrailerswithout ever polling the inner body. The next time we poll we callpoll_trailerson the inner body it ends up at the "Trailers polled while body still has data" error. This error is correct, we are polling trailers while the body still has data.It turns out Yuki already did a fix for this in his merge from
mainto the feature branch by setting thestream_lengthand changing the asserts to properly look for the body data. That change is in an inlineable and still in the feature branch, so the published version of the S3 crate used by the semver hazards check doesn't have the fixed test.The minimum fix here is to port the changes for the tests in
aws_chunkedto main since the current version of those tests is kind of wrong anyway, not polling through the body data at all. We got (un)lucky this showed up in the feature branch because the http-1xSdkBodychecks for body data when polling trailers since they can't be polled separately.But all of this debugging brings us to the underlying bug, when the inner body of an
SdkBodyisBoxBody::HttpBody04our implementation will happily let you poll trailers while the body still has data. As far as I am aware there is no use case that would make this a reasonable thing to do. To fix the actual bug I see two possible solutions:BoxBody::HttpBody04branch inSdkBody'spoll_next_trailermethod to return an error by callingpoll_dataon the inner body inpoll_next_trailersand failing if it returns anything other thanPoll::Ready(none). Unfortunately it seems possible that this could cause tricky runtime breakages for existing users, so probably isn't a tenable option.BoxBody::HttpBody1branch inSdkBody'spoll_next_trailermethod to act more like theBoxBody::HttpBody04branch. In this case if it encountered a data frame rather than a trailer frame it would keep polling the frames until the body data is exhausted (either buffering or just throwing away the data frames) and we get a trailer frame or run out of frames. This feels incorrect as polling the trailers before the body is exhausted shouldn't ever be correct, and polling the trailer inHttpBody04doesn't actually throw away the body bytes, they could still be polled later.Testing
I used
runtime-versioner patch-runtimelocally to patch thefeature/http-1.xbranch versions of the runtime crates into a local checkout of theaws-sdk-s3crate. This reproduced the failure locally. Manually updating the inlineableaws_chunked.rsin the S3 crate with the changes from this PR allowed the tests to pass.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.